<template>
  <van-tabbar v-model="active" route="true">
    <van-tabbar-item icon="wap-home-o" to="/home">首页</van-tabbar-item>
    <van-tabbar-item icon="bar-chart-o" to="/category">分类</van-tabbar-item>
    <van-tabbar-item icon="shopping-cart-o" to="/cart" :badge="cart.badge ?cart.badge:''">购物车</van-tabbar-item>
    <van-tabbar-item icon="user-o" to="/user">我的</van-tabbar-item>
  </van-tabbar>
</template>

<script setup>
import {ref} from 'vue'
import useCartStore from '../store/cart.js'

const active = ref(0);
const cart=useCartStore()
cart.initBadge()


</script>

<style lang="less" scoped></style>